<?php include dirname(__FILE__).'/common/header.php'; ?>

<?php include dirname(__FILE__).'/common/menu.php'; ?>

var attr = {};
attr.ctrlName = '<?php echo $ctrlName; ?>';
attr.game_gift = <?php echo $game_gift ?>;


var headers = [['user_code','店铺编码'],['user_name','店铺名称'],['customer_id','顾客ID']
    ,['openid','openid'],['gift_type','类别',function(val) {
        return ZM.id2name(val,attr.game_gift);
    }],['code','卡券号']
    ,['customer_name','姓名'],['customer_car_number','车架号'],['lottery_time_time_create','创建时间']
    ,['lottery_time_time_active','激活时间'],['validate_source','核销来源']];
/*
| -------------------------------------------------------------------
|  List Grid
| -------------------------------------------------------------------
*/
list.grid = new ZM.GridPanel({
    url: list.baseUrl + attr.ctrlName+'/getCodeList',
    tbar:[{
        text:'导出过滤记录',
        cls:'btn-show',
        hidden:!Ext.permission[attr.ctrlName + '/exportList'.toLowerCase()],
        handler:function() {
            var sortInfo = list.grid.store.getSortState();
            if(sortInfo) {
                list.grid.store.baseParams['sort'] = sortInfo['field'];
                list.grid.store.baseParams['dir'] = sortInfo['direction'];
            }
            if(!window.btoa) {
                alert('请使用高级浏览器下载，比如chrome,firefox,safari或者非IE兼容版!');
                return;
            }
            exportExcel(list.grid,headers,'广汽本田9月区域特色售后服务活动核销记录','广汽本田9月区域特色售后服务活动核销记录'+(new Date().getTime())+'.xlsx');
            //location.href = list.baseUrl + attr.ctrlName + '/exportList?'+ (new Date().getTime()) + '&' + Ext.urlEncode(list.grid.store.baseParams);
        }
    }],
    columns:[
        {header:'店铺编码',dataIndex:'user_code',filter:{}},
        {header:'店铺名称',dataIndex:'user_name',filter:{}},
        {header:'顾客ID',dataIndex:'customer_id',filter:{}},
        {header:'openid',dataIndex:'openid',width:150,filter:{}},
        {header:'类别',dataIndex:'gift_type',width:100,renderer:function(val) {
            var str = ZM.id2name(val,attr.game_gift);
            return str;
        },filter:{
            xtype:'combofield',
            options:[['','全部']].concat(attr.game_gift)
        }},
        {header:'卡券号',dataIndex:'code',filter:{}},
        //{header:'状态',dataIndex:'gift_status',renderer:ZM.status,filter:{xtype:'combofield',options:[['','全部']].concat([['0','未领取'],['1','已领取']])}},
        {header:'姓名',dataIndex:'customer_name',filter:{}},
        {header:'车架号',dataIndex:'customer_car_number',width:120},
        {header:'创建时间',dataIndex:'lottery_time_time_create',width:140,filter:{xtype:'daterangefield'}},
        {header:'激活时间',dataIndex:'lottery_time_time_active',width:140,filter:{xtype:'daterangefield'}},
        {header:'核销来源',dataIndex:'validate_source',filter:{}}
    ]
});
/*
| -------------------------------------------------------------------
|  List Grid Action
| -------------------------------------------------------------------
*/


<?php include dirname(__FILE__).'/common/layout.php'; ?>
list.grid.store.load();
<?php include dirname(__FILE__).'/common/footer.php'; ?>
